Answer:

No. The formal parameter amount belongs to the processDeposit method. It cannot be used by any other method.

Scope of a Formal Parameter

The scope of a formal parameter is the section of code that can "see" (can use) the parameter. The scope of a formal parameter is the body of its method. For example, the scope of amount is the body of its method:

class CheckingAccount
{
  . . . .
  private int    balance;

  . . . .
  void  processDeposit( int amount )
  { // scope of amount starts here
    balance = balance + amount ;      
    // scope of amount ends here
  }

  // modified display method
  void display()
  {
    System.out.println( balance + "\t" + amount );  // syntax error 
  }

}

The display() method cannot "see" amount because it is outside the scope of amount. The compiler will not compile this modified program.

QUESTION 5:

Can the display() method see the object's instance variables, such as balance?